package com.happyhome.datamodel;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;


/**
 * The persistent class for the house database table.
 * 
 */
@Entity
@Table(name="HOUSE")
public class House implements Serializable {
	private static final long serialVersionUID = 1L;
	private Long idHouse;
	private String address;
	private Date checkInDate;
	private Date checkOutDate;
	private String codeHouse;
	private Long deposit;
	private String description;
	private String googleMap;
	private Integer monthsHire;
	private String nameHouse;
	private String pictures;
	private Long rentalCost;
	private Integer rooms;
	private Long sqft;
	private Boolean status;
	private District district;
	private Boolean isDisplay;
	private Set<HouseUtility> houseUtilities = new HashSet<HouseUtility>();
	private Set<Room> roomsSet = new HashSet<Room>();
	private Set<Image> images = new HashSet<Image>();
	
	private User user;
	
	@Transient
	private String managerName;
	private Date makeDate;
	
	@Transient
    private String url;
	
	@Transient
    private String managerUrl;
	
	public House() {
	}

	@Id
	@Column(name="ID_HOUSE")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getIdHouse() {
		return this.idHouse;
	}

	public void setIdHouse(Long idHouse) {
		this.idHouse = idHouse;
	}


	@Column(name="address")
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}


	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="CHECK_IN_DATE")
	public Date getCheckInDate() {
		return this.checkInDate;
	}

	public void setCheckInDate(Date checkInDate) {
		this.checkInDate = checkInDate;
	}


	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="CHECK_OUT_DATE")
	public Date getCheckOutDate() {
		return this.checkOutDate;
	}

	public void setCheckOutDate(Date checkOutDate) {
		this.checkOutDate = checkOutDate;
	}


	@Column(name="CODE_HOUSE")
	public String getCodeHouse() {
		return this.codeHouse;
	}

	public void setCodeHouse(String codeHouse) {
		this.codeHouse = codeHouse;
	}

	@Column(name="DEPOSIT")
	public Long getDeposit() {
		return this.deposit;
	}

	public void setDeposit(Long deposit) {
		this.deposit = deposit;
	}

	@Column(name="DESCRIPTION")
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}


	@Column(name="GOOGLE_MAP")
	public String getGoogleMap() {
		return this.googleMap;
	}

	public void setGoogleMap(String googleMap) {
		this.googleMap = googleMap;
	}


	@Column(name="MONTHS_HIRE")
	public Integer getMonthsHire() {
		return this.monthsHire;
	}

	public void setMonthsHire(Integer monthsHire) {
		this.monthsHire = monthsHire;
	}


	@Column(name="NAME_HOUSE")
	public String getNameHouse() {
		return this.nameHouse;
	}

	public void setNameHouse(String nameHouse) {
		this.nameHouse = nameHouse;
	}

	@Column(name="PICTURES")
	public String getPictures() {
		return this.pictures;
	}

	public void setPictures(String pictures) {
		this.pictures = pictures;
	}


	@Column(name="RENTAL_COST")
	public Long getRentalCost() {
		return this.rentalCost;
	}

	public void setRentalCost(Long rentalCost) {
		this.rentalCost = rentalCost;
	}

	@Column(name="ROOMS")
	public Integer getRooms() {
		return this.rooms;
	}

	public void setRooms(Integer rooms) {
		this.rooms = rooms;
	}

	@Column(name="SQFT")
	public Long getSqft() {
		return this.sqft;
	}

	public void setSqft(Long sqft) {
		this.sqft = sqft;
	}

	@Column(name="STATUS")
	public Boolean getStatus() {
		return this.status;
	}

	public void setStatus(Boolean status) {
		this.status = status;
	}

	@Column(name="IS_DISPLAY")
	public Boolean getIsDisplay() {
		return isDisplay;
	}

	public void setIsDisplay(Boolean isDisplay) {
		this.isDisplay = isDisplay;
	}
	
	//bi-directional many-to-one association to District
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="DISTRICT_ID")
	public District getDistrict() {
		return this.district;
	}

	public void setDistrict(District district) {
		this.district = district;
	}


	//bi-directional many-to-one association to HouseUtility
	@OneToMany(mappedBy="house", fetch = FetchType.LAZY)
	public Set<HouseUtility> getHouseUtilities() {
		return this.houseUtilities;
	}

	public void setHouseUtilities(Set<HouseUtility> houseUtilities) {
		this.houseUtilities = houseUtilities;
	}

	//bi-directional many-to-one association to Room
	@OneToMany(mappedBy = "house", fetch = FetchType.LAZY)
	public Set<Room> getRoomsSet() {
		return this.roomsSet;
	}

	public void setRoomsSet(
			Set<Room> roomsSet) {
		this.roomsSet = roomsSet;
	}

	//bi-directional many-to-one association to User
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="MANAGER_USERNAME")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	//bi-directional many-to-one association to Room
	@OneToMany(mappedBy = "house", fetch = FetchType.LAZY)
	public Set<Image> getImages() {
		return this.images;
	}

	public void setImages(
			Set<Image> images) {
		this.images = images;
	}

	@Transient
	public String getManagerName() {
		return managerName;
	}

	public void setManagerName(String managerName) {
		this.managerName = managerName;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="make_date")
	public Date getMakeDate() {
		return this.makeDate;
	}

	public void setMakeDate(Date makeDate) {
		this.makeDate = makeDate;
	}

	@Transient
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Transient
	public String getManagerUrl() {
		return managerUrl;
	}

	public void setManagerUrl(String managerUrl) {
		this.managerUrl = managerUrl;
	}
}